﻿seajs.config({
    base: '../js/',
    alias: {
        'labjs': 'lib/LAB.min',
    }
});

define(function (require) {
    require('labjs');
    var token;

    // 载入基础lib
    $LAB.script('../js/lib/jquery-1.6.1.min.js').wait()
        .script('../js/lib/jquery.mobile-1.0b2.js').wait()
        .script('../js/lib/underscore-min.js').wait()
        .script('../js/lib/backbone.min.js').wait(
            function () {
                $('#page').live('pagecreate',function(event){
                    var service = require('utility/service');   
                    
                    $('#btn-signin').click(function(){
                        var userName = $('#name').val();
                        var password = $('#password').val();

                        service.Login(function(e){
                            service.setAuthToken(e.Data.Token);

                            if(e.Status == "Success"){
                                alert('goooooooood!')
                            }
                        },{userName:  userName, password: password})
                        
                    })
                });

            }
        )
});
